import { getChannelAPI } from "@/apis/article"
import { useState,useEffect } from "react"

//封装获取频道列表
export const useChannel=()=>{
    //1.获取频道列表
    const [channelList,setChannelList]=useState()
    useEffect(()=>{
        const getChannelList=async()=>{
            const res=await getChannelAPI()
            setChannelList(res.data.data.channels)
        }
        getChannelList()
    },[])
    // 2.导出需要的数据
    return{
        channelList
    }

}